<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.java.user.User" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>个人设置</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<script language="JavaScript">
	function check(frm) {
	if(frm.userName.value=="") {
	alert("用户名不能为空！");
	return false;
	}
	var reg1=/[a-zA-Z]\w*/;
	if(!reg1.test(frm.userName.value)) {
	alert("用户名格式不正确");
	return false;
	}
	if(frm.userPwd.value.length<6) {
	alert("密码长度不能小于6！");
	return false;
	}
	if(frm.userPwd1.value!=frm.userPwd.value) {
	alert("密码不一致！");
	return false;
	}
	
	if(frm.userEmail.value=="") {
	alert("用户邮箱不能为空！");
	return false;
	}
	if(frm.file.value=="") {
	alert("照片不能为空！");
	return false;
	}
	return true;
	}
	</script>
  </head>
  
  <body bgcolor="black">
<div style="width: 100%; height: 50%; background-color: rgb(128, 128, 0);">  
    <% User user=(User)session.getAttribute("user"); %>
    <form method="post" enctype="multipart/form-data" action="blog/UserAction?method=edit" onsubmit="return check(this)">

      <input type="hidden" name="userId" value="<%= user.getUserid()  %>" >
        <table border="0" align="center" width="550">
<tbody><tr>
<td colspan="3">设置账户信息</td>
</tr>
<tr>
<td>用户名：</td>
<td><input type="text" name="userName" value="<%= user.getUserName() %>"></td>
<td>&nbsp;</td></tr>
<tr>
<td>密码：</td>
<td><input type="password" name="userPwd" value=""></td>
<td>&nbsp;</td></tr>
<tr>
<td>确认密码：</td>
<td><input type="password" name="userPwd1" value=""></td>
<td>&nbsp;</td></tr>
<tr>
<td>性别：</td>
<td><% if (user.getUserSex().equals("男")) { %>
<input type="radio" name="userSex" value="男" checked="checked" /> &nbsp;<input type="radio" name="userSex" value="女" />
<% } else { %>
<input type="radio" name="userSex" value="男"  /> &nbsp;<input type="radio" name="userSex" value="女" checked="checked" />
<% } %>
</td>
<td>&nbsp;</td></tr>
<tr>
<td>邮件地址：</td>
<td><input type="text" name="userEmail" value="<%= user.getUserEmail() %>" /></td>
<td>&nbsp;</td></tr>
<tr>
<td>基本情况：</td>
<td colspan="2"><textarea name="userBasicInfo" rows="5" cols="50" value="" ></textarea></td>
</tr>
<tr>
<td>个人照片：</td>
<td><input type="file" name="file" value="" style="width:200px;" />请选择个人照片文件(jpg)</td>
</tr>
<tr>
<td colspan="3"><input type="checkbox" name="accept" value="yes" />我已仔细阅读并接受用户协议</td>
</tr>
<tr>
<td colspan="3"><input type="submit" value="确定" />&nbsp;
<input type="button" value="取消" onclick="window.history.back()" /></td>
</tr>

</tbody></table> 
    </form>
    </div>
  </body>
  
</html>
